import { refreshToken } from '../api/user/user';
export async function refresh(instance: any, config: any) {
  const refresh_oken = localStorage.getItem('refresh_token') || '';
  const res = await refreshToken({ refreshToken: refresh_oken });
  if (res.code === 200) {
    localStorage.setItem('access_token', res.data.access_token);
    localStorage.setItem('refresh_token', res.data.refresh_token);
    instance(config);
    return true;
  }
  return false;
}
